﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sausage.Web.Models;

namespace Sausage.Web.Controllers
{
    public class ChartController : Controller
    {
        public ActionResult PieChart()
        {
            return View();
        }

        public ActionResult ColumnChart()
        {
            return View();
        }

        public ActionResult BarChart()
        {
            return View();
        }

        public ActionResult SpainPieChart()
        {
            return Json(new List<PieTargetSource>
                            {
                                new PieTargetSource
                                    {
                                        Source = "已发生工料机费用：XXXX万元",
                                        Percentage = 33
                                    },

                                new PieTargetSource
                                    {
                                        Source = "工程总金额：XXXX万元",
                                        Percentage = 67
                                    }
                            });
        }

        public ActionResult SpainColumnChart()
        {
            var list = new List<ComparedData>
                           {
                               new ComparedData
                                   {
                                       DataCategory = "XX养护类型",
                                       PlanValue = 10458,
                                       RealValue = 2015
                                   },

                               new ComparedData
                                   {
                                       DataCategory = "处理翻浆",
                                       PlanValue = 21598,
                                       RealValue = 6003
                                   },

                               new ComparedData
                                   {
                                       DataCategory = "修补裂缝",
                                       PlanValue = 22623,
                                       RealValue = 6881
                                   },

                               new ComparedData
                                   {
                                       DataCategory = "混凝土路面修补",
                                       PlanValue = 31167,
                                       RealValue = 4060
                                   },

                               new ComparedData
                                   {
                                       DataCategory = "警示桩",
                                       PlanValue = 33663,
                                       RealValue = 10254
                                   },

                               new ComparedData
                                   {
                                       DataCategory = "清理桥头垃圾",
                                       PlanValue = 29896,
                                       RealValue = 9546
                                   },

                               new ComparedData
                                   {
                                       DataCategory = "维修涵洞盖板",
                                       PlanValue = 24714,
                                       RealValue = 7332
                                   },
                           };
            return Json(list);
        }

        public ActionResult SpainBarChart()
        {
            var list = new List<ProjectChartData>
                           {
                               new ProjectChartData
                                   {
                                       DataCategory = "XX分项工程",
                                       PlanValue = 10458,
                                       RealValue = 2015
                                   },

                               new ProjectChartData
                                   {
                                       DataCategory = "清理与掘除",
                                       PlanValue = 21598,
                                       RealValue = 6003
                                   },

                               new ProjectChartData
                                   {
                                       DataCategory = "坡面加固",
                                       PlanValue = 22623,
                                       RealValue = 6881
                                   },

                               new ProjectChartData
                                   {
                                       DataCategory = "黄土处理",
                                       PlanValue = 31167,
                                       RealValue = 4060
                                   },

                               new ProjectChartData
                                   {
                                       DataCategory = "弃方运输",
                                       PlanValue = 33663,
                                       RealValue = 10254
                                   },

                               new ProjectChartData
                                   {
                                       DataCategory = "土路肩加固",
                                       PlanValue = 29896,
                                       RealValue = 9546
                                   },

                               new ProjectChartData
                                   {
                                       DataCategory = "石灰稳定类底基层",
                                       PlanValue = 24714,
                                       RealValue = 7332
                                   },
                           };
            return Json(list);
        }
    }
}
